<!DOCTYPE html>
<html lang="zh-CN">
  <head>
   <#include "/header.html" parse=true>
   <script type="text/javascript">
   function deleteUser(userName)
   {
	    if(confirm("确认删除吗？")){
	        window.location.href = "/user?op=delete&userName="+userName;
	    }
   }
   function exportUser()
   {
      var userName = $("#userName").val();
      var groupName = $("#groupName").val();
      window.location.href = "/user?op=export&userName="+userName+"&groupName="+groupName;
   }
   </script>   
  </head>
  <body>
  <#include "/nav.html" parse=true>
	<div class="main-box">
		<div class="container">
		    <div class="row">
               <#include "/menu.html" parse=true>
				<div class="span9">
					<ul class="breadcrumb">
						<li><b>用户管理</b> <span class="divider">/</span></li>
						<li><a href="/user">用户查询</a><span class="divider">/</span></li>
						<li><a href="/user?op=add">新增用户</a><span class="divider">/</span></li>
						<li><a href="/user/import">导入用户</a></li>
					</ul>
					<form class="form-inline" action="/user" method="get">
					  <label class="control-label" for="userName">用户名:</label>
					  <input type="text" class="span2" id="userName" name="userName" value="${param_userName!!}" placeholder="支持模糊查询">
					  <label class="control-label" for="groupName">用户组:</label>
					  <select id="groupName" name="groupName">
					               <option value="">所有</option>
								    <#list groups as group>
									<option value="${group.getGroupName()}"   ${context.seclet(group.getGroupName(),param_groupName)}>${group.getGroupDesc()}</option>
									</#list>
								</select>
					  <button type="submit" class="btn">查询</button>
					   <a class="btn" onclick="exportUser();">导出</a>
					</form>
					<table class="table table-striped table-bordered table-hover">
					  <thead>
							<tr>
								<th>用户名</th>
								<th>用户组</th>
								<th>操作</th>
							</tr>			
						</thead>		
						<tbody>
							<#list users as user>
							<tr>
								<td>${user.getUserName()}</td>
								<td>${user.getGroupName()}</td>
								<td>
								<a href="/user?op=view&userName=${user.getUserName()}">详情</a>
								<span class="divider">/</span>
								<a href="javascript:deleteUser('${user.getUserName()}')">删除</a>
								</td>
							</tr>
							</#list>
						</tbody>
					</table>
					
					<#if prev?? ||  next??>
                        <ul class="pager">
                        <#if prev??>
                        <li> <a href="/user?page=${prev}">上一页</a></li>
                        </#if>
                        <#if next??>
                        <li><a href="/user?page=${next}">下一页</a></li>
                        </#if>
                        </ul>
                    </#if>              
					
				</div>
			</div>
		</div>
    </div > <!-- /container -->
  <#include "/footer.html" parse=true>
  </body>
</html>
